<?php
/**
 * Description: 行测-笔记-删除
 * User: devforma
 * Date: 16/11/4
 * Time: 16:31
 */


class DelQuestionNotes implements iController {
    private static $MODULE_DIR;

    function __construct() {
        self::$MODULE_DIR  = __DIR__ . '/modules/';
    }

    public function output($queryArgs) {
        global $uddb;

        if (validateUser($queryArgs) !== 1 || empty($queryArgs['question_id']))
            return genOutput(1000);

        $questionNote = getQuestionNotes($queryArgs);

        if (!empty($questionNote)) {

            $where = [
                'user_id'       => $queryArgs['user_id'],
                'question_id'   => $queryArgs['question_id']
            ];

            $status =$uddb->delete("user_question_notes", $where);
            $message = $status ? '删除成功!' : '删除失败!';
        }else{
            $message = '该记录不存在!';
        }
        return genOutput(1, ['response_msg' => $message]);
    }
}